-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Clang] Use "syncscope" instead of "synchscope". NFC. #134616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This matches the spelling of the keyword in LLVM IR.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: Jay Foad (jayfoad) ChangesThis matches the spelling of the keyword in LLVM IR. Full diff: https://github.com/llvm/llvm-project/pull/134616.diff 6 Files Affected:
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 08e34fdf2aa2f..dedbff5944af8 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -6757,7 +6757,7 @@ class PseudoObjectExpr final
/// and corresponding __opencl_atomic_* for OpenCL 2.0.
/// All of these instructions take one primary pointer, at least one memory
/// order. The instructions for which getScopeModel returns non-null value
-/// take one synch scope.
+/// take one sync scope.
class AtomicExpr : public Expr {
public:
enum AtomicOp {
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 393bfecf9a36b..12c1d89ef0e14 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9075,7 +9075,7 @@ def err_atomic_op_needs_atomic_int : Error<
def warn_atomic_op_has_invalid_memory_order : Warning<
"%select{|success |failure }0memory order argument to atomic operation is invalid">,
InGroup<DiagGroup<"atomic-memory-ordering">>;
-def err_atomic_op_has_invalid_synch_scope : Error<
+def err_atomic_op_has_invalid_sync_scope : Error<
"synchronization scope argument to atomic operation is invalid">;
def warn_atomic_implicit_seq_cst : Warning<
"implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
diff --git a/clang/include/clang/Basic/SyncScope.h b/clang/include/clang/Basic/SyncScope.h
index 45beff41afa11..5a8d2a7dd02e5 100644
--- a/clang/include/clang/Basic/SyncScope.h
+++ b/clang/include/clang/Basic/SyncScope.h
@@ -21,17 +21,17 @@
namespace clang {
-/// Defines synch scope values used internally by clang.
+/// Defines sync scope values used internally by clang.
///
/// The enum values start from 0 and are contiguous. They are mainly used for
-/// enumerating all supported synch scope values and mapping them to LLVM
-/// synch scopes. Their numerical values may be different from the corresponding
-/// synch scope enums used in source languages.
+/// enumerating all supported sync scope values and mapping them to LLVM
+/// sync scopes. Their numerical values may be different from the corresponding
+/// sync scope enums used in source languages.
///
-/// In atomic builtin and expressions, language-specific synch scope enums are
+/// In atomic builtin and expressions, language-specific sync scope enums are
/// used. Currently only OpenCL memory scope enums are supported and assumed
/// to be used by all languages. However, in the future, other languages may
-/// define their own set of synch scope enums. The language-specific synch scope
+/// define their own set of sync scope enums. The language-specific sync scope
/// values are represented by class AtomicScopeModel and its derived classes.
///
/// To add a new enum value:
@@ -88,31 +88,31 @@ inline llvm::StringRef getAsString(SyncScope S) {
case SyncScope::OpenCLSubGroup:
return "opencl_subgroup";
}
- llvm_unreachable("Invalid synch scope");
+ llvm_unreachable("Invalid sync scope");
}
/// Defines the kind of atomic scope models.
enum class AtomicScopeModelKind { None, OpenCL, HIP, Generic };
-/// Defines the interface for synch scope model.
+/// Defines the interface for sync scope model.
class AtomicScopeModel {
public:
virtual ~AtomicScopeModel() {}
- /// Maps language specific synch scope values to internal
+ /// Maps language specific sync scope values to internal
/// SyncScope enum.
virtual SyncScope map(unsigned S) const = 0;
- /// Check if the compile-time constant synch scope value
+ /// Check if the compile-time constant sync scope value
/// is valid.
virtual bool isValid(unsigned S) const = 0;
- /// Get all possible synch scope values that might be
+ /// Get all possible sync scope values that might be
/// encountered at runtime for the current language.
virtual ArrayRef<unsigned> getRuntimeValues() const = 0;
/// If atomic builtin function is called with invalid
- /// synch scope value at runtime, it will fall back to a valid
- /// synch scope value returned by this function.
+ /// sync scope value at runtime, it will fall back to a valid
+ /// sync scope value returned by this function.
virtual unsigned getFallBackValue() const = 0;
/// Create an atomic scope model by AtomicScopeModelKind.
@@ -120,7 +120,7 @@ class AtomicScopeModel {
static std::unique_ptr<AtomicScopeModel> create(AtomicScopeModelKind K);
};
-/// Defines the synch scope model for OpenCL.
+/// Defines the sync scope model for OpenCL.
class AtomicScopeOpenCLModel : public AtomicScopeModel {
public:
/// The enum values match the pre-defined macros
@@ -147,7 +147,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
case SubGroup:
return SyncScope::OpenCLSubGroup;
}
- llvm_unreachable("Invalid language synch scope value");
+ llvm_unreachable("Invalid language sync scope value");
}
bool isValid(unsigned S) const override {
@@ -156,7 +156,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
}
ArrayRef<unsigned> getRuntimeValues() const override {
- static_assert(Last == SubGroup, "Does not include all synch scopes");
+ static_assert(Last == SubGroup, "Does not include all sync scopes");
static const unsigned Scopes[] = {
static_cast<unsigned>(WorkGroup), static_cast<unsigned>(Device),
static_cast<unsigned>(AllSVMDevices), static_cast<unsigned>(SubGroup)};
@@ -168,7 +168,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
}
};
-/// Defines the synch scope model for HIP.
+/// Defines the sync scope model for HIP.
class AtomicScopeHIPModel : public AtomicScopeModel {
public:
/// The enum values match the pre-defined macros
@@ -198,7 +198,7 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
case System:
return SyncScope::HIPSystem;
}
- llvm_unreachable("Invalid language synch scope value");
+ llvm_unreachable("Invalid language sync scope value");
}
bool isValid(unsigned S) const override {
@@ -207,7 +207,7 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
}
ArrayRef<unsigned> getRuntimeValues() const override {
- static_assert(Last == System, "Does not include all synch scopes");
+ static_assert(Last == System, "Does not include all sync scopes");
static const unsigned Scopes[] = {
static_cast<unsigned>(SingleThread), static_cast<unsigned>(Wavefront),
static_cast<unsigned>(Workgroup), static_cast<unsigned>(Agent),
diff --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp
index 3adb2a7ad207f..672e82f8dcc3e 100644
--- a/clang/lib/CodeGen/CGAtomic.cpp
+++ b/clang/lib/CodeGen/CGAtomic.cpp
@@ -781,8 +781,8 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr *Expr, Address Dest,
llvm::Value *Scope) {
auto ScopeModel = Expr->getScopeModel();
- // LLVM atomic instructions always have synch scope. If clang atomic
- // expression has no scope operand, use default LLVM synch scope.
+ // LLVM atomic instructions always have sync scope. If clang atomic
+ // expression has no scope operand, use default LLVM sync scope.
if (!ScopeModel) {
llvm::SyncScope::ID SS;
if (CGF.getLangOpts().OpenCL)
@@ -821,8 +821,8 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr *Expr, Address Dest,
CGF.createBasicBlock("atomic.scope.continue", CGF.CurFn);
auto *SC = Builder.CreateIntCast(Scope, Builder.getInt32Ty(), false);
- // If unsupported synch scope is encountered at run time, assume a fallback
- // synch scope value.
+ // If unsupported sync scope is encountered at run time, assume a fallback
+ // sync scope value.
auto FallBack = ScopeModel->getFallBackValue();
llvm::SwitchInst *SI = Builder.CreateSwitch(SC, BB[FallBack]);
for (auto S : Scopes) {
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 5a4fa97366809..c21475ee69d9e 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4229,7 +4229,7 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
if (std::optional<llvm::APSInt> Result =
Scope->getIntegerConstantExpr(Context)) {
if (!ScopeModel->isValid(Result->getZExtValue()))
- Diag(Scope->getBeginLoc(), diag::err_atomic_op_has_invalid_synch_scope)
+ Diag(Scope->getBeginLoc(), diag::err_atomic_op_has_invalid_sync_scope)
<< Scope->getSourceRange();
}
SubExprs.push_back(Scope);
diff --git a/clang/test/SemaOpenCL/atomic-ops.cl b/clang/test/SemaOpenCL/atomic-ops.cl
index 209de22ecdf57..7a273546db772 100644
--- a/clang/test/SemaOpenCL/atomic-ops.cl
+++ b/clang/test/SemaOpenCL/atomic-ops.cl
@@ -159,7 +159,7 @@ void memory_checks(atomic_int *Ap, int *p, int val) {
(void)__opencl_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_relaxed, memory_scope_work_group);
}
-void synchscope_checks(atomic_int *Ap, int scope) {
+void syncscope_checks(atomic_int *Ap, int scope) {
(void)__opencl_atomic_load(Ap, memory_order_relaxed, memory_scope_work_item); // expected-error{{synchronization scope argument to atomic operation is invalid}}
(void)__opencl_atomic_load(Ap, memory_order_relaxed, memory_scope_work_group);
(void)__opencl_atomic_load(Ap, memory_order_relaxed, memory_scope_device);
|
tbaederr
approved these changes
Apr 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:codegen
IR generation bugs: mangling, exceptions, etc.
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang
Clang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This matches the spelling of the keyword in LLVM IR.